Crate diesel_connection[−][src]
Expand description
Static diesel r2d2 connection pooling.
DATABASE_URL
env sets postgres database url within connection manager
MAX_DB_CONNECTIONS
env sets max postgres connections within connection pool
use diesel_connection::{get_connection, PoolError};
fn main() -> Result<(), PoolError> {
// DATABASE_URL can be set any time before the pool is lazily initialized on first use
dotenv().expect("Unable to load .env file");
env_logger::init();
let conn = get_connection()?;
}
Functions
Retrieves a connection from a lazily initialized connection pool
Type Definitions
A re-export of r2d2::Error
, which is only used by methods on r2d2::Pool
.